package com.roc.web.action.settlemorg;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

@SuppressWarnings("serial")
public class SettlementOrgMoneySearchCondition extends BaseSearchCondition {
	private String phone;
	private String accountNo;
	private String applyDateMin;
	private String applyDateMax;
	private String org;
	private String channel;//用于出款-通道
	private String remark;//用于出款--备注
	private String type;//出款类型
	private String amtMin;//拼凑最小值
	private String amtMax;//拼凑最大值
	private String combingName;//拼凑标志
	private String combineFlag;//是否进行拼凑
	private String nature;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();

		if(Constance.isNotEmpty(phone)){
			filedBeanList.add(new WhereHQLFieldBean("s.mobile_no",phone.trim(),"=",false));
		}
		if(Constance.isNotEmpty(accountNo)){
			filedBeanList.add(new WhereHQLFieldBean("s.account_id",accountNo.trim(),"=",false));
		}
		
		if(Constance.isNotEmpty(applyDateMin)){
			filedBeanList.add(new WhereHQLFieldBean("s.trans_dt", applyDateMin.trim(),">=", false));
		}
		if(Constance.isNotEmpty(applyDateMax)){
			filedBeanList.add(new WhereHQLFieldBean("s.trans_dt", applyDateMax.trim(),"<=", false));
		}
		if(Constance.isNotEmpty(org)){
			filedBeanList.add(new WhereHQLFieldBean("s.ins_id_cd", org.trim(),"=", false));
		}
		if(Constance.isNotEmpty(type)){
			filedBeanList.add(new WhereHQLFieldBean("s.ma_trans_cd", type.trim(),"=", false));
		}
		if(Constance.isNotEmpty(amtMax)){
			filedBeanList.add(new WhereHQLFieldBean("s.remark5",combingName.trim(),"=", false));
		}
		if(Constance.isNotEmpty(nature)){
			if("01".equals(nature)){
				filedBeanList.add(new WhereHQLFieldBean("length(s.pye_acct_nm)>5 and s.pye_acct_nm not like '%·%'"));
			}else if("02".equals(nature)){
				filedBeanList.add(new WhereHQLFieldBean("(length(s.pye_acct_nm)<5 or s.pye_acct_nm like '%·%')"));
			}else if("03".equals(nature)){
				filedBeanList.add(new WhereHQLFieldBean(" length(s.pye_acct_nm)=5 "));
			}
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select count(*) from apstfr.tbl_ins_pay_detail s where status='01'");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select s.trans_dt,s.key_rsp,s.ma_trans_cd,s.ins_id_cd,s.account_id,s.mobile_no,s.total_count,s.pay_amt,s.total_fee,s.pye_acct_no,s.pye_acct_nm,s.status,s.pye_bank_nm from apstfr.tbl_ins_pay_detail s where status='01'");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		return "order by s.rec_crt_ts desc";
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getApplyDateMin() {
		return applyDateMin;
	}

	public void setApplyDateMin(String applyDateMin) {
		this.applyDateMin = applyDateMin;
	}

	public String getApplyDateMax() {
		return applyDateMax;
	}

	public void setApplyDateMax(String applyDateMax) {
		this.applyDateMax = applyDateMax;
	}

	public String getOrg() {
		return org;
	}

	public void setOrg(String org) {
		this.org = org;
	}

	public String getChannel() {
		return channel;
	}

	public void setChannel(String channel) {
		this.channel = channel;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getAmtMin() {
		return amtMin;
	}

	public void setAmtMin(String amtMin) {
		this.amtMin = amtMin;
	}

	public String getAmtMax() {
		return amtMax;
	}

	public void setAmtMax(String amtMax) {
		this.amtMax = amtMax;
	}

	public String getCombingName() {
		return combingName;
	}

	public void setCombingName(String combingName) {
		this.combingName = combingName;
	}

	public String getCombineFlag() {
		return combineFlag;
	}

	public void setCombineFlag(String combineFlag) {
		this.combineFlag = combineFlag;
	}

	public String getNature() {
		return nature;
	}

	public void setNature(String nature) {
		this.nature = nature;
	}

	
}
